package cn.tom.org.pojo.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
@TableName("t_department")
public class Department {
    @TableId(type = IdType.AUTO)
    private Long id;
    private String sn;
    private String name;
    private String dirPath;
    private Integer state;
    private Long managerId;
    private Long parentId;

   //部门经理信息
    @TableField(exist = false)
    @ApiModelProperty(hidden = true)
    private Employee manager;

    //上级部门信息
    @TableField(exist = false)
    @ApiModelProperty(hidden = true)
    private Department parent;

    //用于保存当前部门下是所有子部门
    //部门树最后一级没有数据就不显示
    @TableField(exist = false)
    @ApiModelProperty(value = "子部门树")
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<Department> children = new ArrayList<>();
}
